Skip to content

Conversation

@AaronBallman
Copy link
Collaborator

Silence MSVC warnings; NFC
After the changes to DynamicRecursiveASTVisitor, we started getting several warnings from MSVC like:

warning C4661: 'bool clang::DynamicRecursiveASTVisitorBase::WalkUpFromNamedDecl(clang::NamedDecl *)': no suitable definition provided for explicit template instantiation request

These changes silence the warnings by providing a definition for those functions.

Silence MSVC warnings; NFC
After the changes to DynamicRecursiveASTVisitor, we started getting
several warnings from MSVC like:

warning C4661: 'bool clang::DynamicRecursiveASTVisitorBase<false>::WalkUpFromNamedDecl(clang::NamedDecl *)':
no suitable definition provided for explicit template instantiation request

These changes silence the warnings by providing a definition for those
functions.
@llvmbot llvmbot added clang Clang issues not falling into any other category clang:frontend Language frontend issues, e.g. anything involving "Sema" labels Jan 30, 2025
@llvmbot
Copy link
Member

llvmbot commented Jan 30, 2025

@llvm/pr-subscribers-clang

Author: Aaron Ballman (AaronBallman)

Changes

Silence MSVC warnings; NFC
After the changes to DynamicRecursiveASTVisitor, we started getting several warnings from MSVC like:

warning C4661: 'bool clang::DynamicRecursiveASTVisitorBase<false>::WalkUpFromNamedDecl(clang::NamedDecl *)': no suitable definition provided for explicit template instantiation request

These changes silence the warnings by providing a definition for those functions.


Full diff: https://github.com/llvm/llvm-project/pull/125100.diff

1 Files Affected:

  • (modified) clang/include/clang/AST/DynamicRecursiveASTVisitor.h (+2-2)
diff --git a/clang/include/clang/AST/DynamicRecursiveASTVisitor.h b/clang/include/clang/AST/DynamicRecursiveASTVisitor.h
index 4e0ba568263bf3..703cca22777ad0 100644
--- a/clang/include/clang/AST/DynamicRecursiveASTVisitor.h
+++ b/clang/include/clang/AST/DynamicRecursiveASTVisitor.h
@@ -251,11 +251,11 @@ template <bool IsConst> class DynamicRecursiveASTVisitorBase {
   // Decls.
 #define ABSTRACT_DECL(DECL)
 #define DECL(CLASS, BASE)                                                      \
+  bool WalkUpFrom##CLASS##Decl(MaybeConst<CLASS##Decl> *D);                    \
   virtual bool Traverse##CLASS##Decl(MaybeConst<CLASS##Decl> *D);
 #include "clang/AST/DeclNodes.inc"
 
 #define DECL(CLASS, BASE)                                                      \
-  bool WalkUpFrom##CLASS##Decl(MaybeConst<CLASS##Decl> *D);                    \
   virtual bool Visit##CLASS##Decl(MaybeConst<CLASS##Decl> *D) { return true; }
 #include "clang/AST/DeclNodes.inc"
 
@@ -272,11 +272,11 @@ template <bool IsConst> class DynamicRecursiveASTVisitorBase {
   // Types.
 #define ABSTRACT_TYPE(CLASS, BASE)
 #define TYPE(CLASS, BASE)                                                      \
+  bool WalkUpFrom##CLASS##Type(MaybeConst<CLASS##Type> *T);                    \
   virtual bool Traverse##CLASS##Type(MaybeConst<CLASS##Type> *T);
 #include "clang/AST/TypeNodes.inc"
 
 #define TYPE(CLASS, BASE)                                                      \
-  bool WalkUpFrom##CLASS##Type(MaybeConst<CLASS##Type> *T);                    \
   virtual bool Visit##CLASS##Type(MaybeConst<CLASS##Type> *T) { return true; }
 #include "clang/AST/TypeNodes.inc"
 

Copy link
Contributor

@cor3ntin cor3ntin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks

@AaronBallman AaronBallman merged commit 72efe15 into llvm:main Jan 30, 2025
11 checks passed
@AaronBallman AaronBallman deleted the aballman-msvc-warning-dyn-recurse branch January 30, 2025 20:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

clang:frontend Language frontend issues, e.g. anything involving "Sema" clang Clang issues not falling into any other category

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants